/*
 * @Author: 'zhangkeqq' '2211709169@qq.com'
 * @Date: 2025-08-01 10:54:30
 * @LastEditors: 'zhangkeqq' '2211709169@qq.com'
 * @LastEditTime: 2025-08-01 11:31:09
 * @FilePath: \vue3-admin-node\vue3-admin\src\store\modules\message.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import {
	defineStore
} from 'pinia'
import {
	getReadListAndStatus,
	getDepartmentMsgList
} from '@/api/dep_msg/index'
export const useMsg = defineStore('messageinfor', {
	state: () => {
		return {
			read_list: [],
			msg_list:[]
		}
	},
	actions: {
		async returnReadList(id:any) {
			this.read_list = []
			this.msg_list = []
			const res:any = await getReadListAndStatus(id)
			this.read_list = JSON.parse(res.data[0].read_list)
			this.msg_list = await getDepartmentMsgList(localStorage.getItem('department'))
		}
	},
	persist:true
})